/**
 * @某个模块下的路由:
 */
import Layout from "@/layout";

//工作台
const WorkSpace = () => import(/* webpackChunkName: "workSpace" */ "views/workSpace/index");
//资产中心
const AssetCenter = () => import(/* webpackChunkName: "assetCenter" */ "views/assetCenter");
const AssetCenterDetail = () => import(/* webpackChunkName: "assetCenter" */ "views/assetCenter/detail");
//风险中心
const RiskCenter = () => import(/* webpackChunkName: "riskCenter" */ "views/riskCenter/");
const RiskCenterDetail = () => import(/* webpackChunkName: "riskCenter" */ "views/riskCenter/detail");

//任务中心（工单中心）
const TaskCenter = () => import(/* webpackChunkName: "taskCenter" */ "views/taskCenter");
const TaskCenterDetail = () => import(/* webpackChunkName: "taskCenter" */ "views/taskCenter/detail");
const MyApproval = () => import(/* webpackChunkName: "taskCenter" */ "views/taskCenter/myApproval");
const MyNotify = () => import(/* webpackChunkName: "taskCenter" */ "views/taskCenter/myNotify");

const taskStatus = "pending|doing|done";
const governType = "store|api|audit-api";

export default {
  //工作台
  // workspace: [{ path: "/workspace/index", component: WorkSpace }],
  //资产中心
  asset: [
    {
      path: "/asset",
      component: Layout,
      redirect: "/asset/store/mysql",
      children: [
        { path: `:type(${governType})/:source`, component: AssetCenter },
        {
          path: `:type(${governType})/:source/:group`,
          component: AssetCenterDetail,
          //dynamicActiveMenu 详情界面 选中对象菜单栏
          meta: { title: "详情", dynamicActiveMenu: true, activeMenu: "/asset" },
        },
      ],
    },
  ],
  //风险中心
  govern: [
    {
      path: "/govern",
      component: Layout,
      redirect: "/govern/store",
      children: [
        {
          path: `:type(${governType})`,
          component: RiskCenter,
        },
        {
          path: `:type(${governType})/:source`,
          hidden: true,
          component: RiskCenterDetail,
          meta: { title: "详情", dynamicActiveMenu: true, activeMenu: "/govern" },
        },
      ],
    },
  ],
  //工单中心
  task: [
    {
      path: "/task",
      component: Layout,
      redirect: "/task/pending",
      children: [
        {
          path: `:status(${taskStatus})`,
          component: TaskCenter,
        },
        {
          path: `:status(${taskStatus})/:source`,
          component: TaskCenterDetail,
          meta: { title: "详情", dynamicActiveMenu: true, activeMenu: "/task" },
        },
        {
          path: `approval`,
          component: MyApproval,
          meta: { title: "我的审批工单" },
        },
        {
          path: `notify`,
          component: MyNotify,
          meta: { title: "我的知会工单" },
        },
      ],
    },
  ],
};
